package com.dao;

import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RoleMenuMapper {

    @Select("SELECT menu_id FROM role_menu WHERE role_id = #{roleId}")
    List<Integer> getMenuIdsByRoleId(Integer roleId);

    @Insert("INSERT INTO role_menu(role_id, menu_id) VALUES(#{roleId}, #{menuId})")
    void insert(@Param("roleId") Integer roleId, @Param("menuId") Integer menuId);

    @Delete("DELETE FROM role_menu WHERE role_id = #{roleId}")
    void deleteByRoleId(Integer roleId);
}
